package cn.gjxblog.core.social.qq.connect;

import cn.gjxblog.core.social.qq.provider.api.QQ;
import cn.gjxblog.core.social.qq.provider.api.QQUser;
import org.springframework.social.connect.ApiAdapter;
import org.springframework.social.connect.ConnectionValues;
import org.springframework.social.connect.UserProfile;

import java.io.IOException;

/**
 * @author gjx
 * @version v1.0
 * @Description
 * @date 2019/1/17 17:14
 */
public class QQAdapter implements ApiAdapter<QQ> {

    //测试QQ连接
    @Override
    public boolean test(QQ qq) {
        return true;
    }

    @Override
    public void setConnectionValues(QQ qq, ConnectionValues connectionValues) {
        QQUser user = qq.getUser();
        connectionValues.setDisplayName(user.getNickname());
        connectionValues.setProviderUserId(user.getOpenId());
        connectionValues.setImageUrl(user.getFigureurl_1());
        connectionValues.setProfileUrl(null);//主页
    }

    @Override
    public UserProfile fetchUserProfile(QQ qq) {
        return null;
    }

    @Override
    public void updateStatus(QQ qq, String s) {

    }
}
